package book;

public class BookList {
    private Book[]  books = new Book[10];//书架
    private int usedSize;//计数器，用来记录当前书架放了几本书

    public BookList() {
        //书架里原先有三本书，这里实例化三本书，也可以通过实例代码块
        this.books[0] = new Book("三国演义","罗贯中",10,"小说");
        this.books[1] = new Book("西游记","吴承恩",23,"小说");;
        this.books[2] = new Book("红楼梦","曹雪芹",8,"小说");;
        this.usedSize = 3;
    }

    //获取当前下标是哪本书
    public Book getBook(int pos){
        return books[pos];
    }


    //设置当前下标为哪本书
    public Book setBook(int pos,Book book){
        return books[pos]=book;
    }

    public int getUsedSize() {
        return usedSize;
    }

    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }
}
